package com.chinaunicom.emergency;

import com.alibaba.fastjson.JSONObject;
import com.chinaunicom.emergency.security.RsaUtil;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class EncodeUser {


//    iam.oauth.client_id_web=mrhcweb
//    iam.oauth.client_id_app=mrhcapp
//    iam.oauth.client_id_pc=mrhcpc
//    iam.oauth.client_secret_web=e685cb8f606f5a7a8720cc45236a130a
//    iam.oauth.client_secret_app=98890563be65564991e223b6eadc5c0a
//    iam.oauth.client_secret_pc=65564563be65564991e223b6cb8f60s
    public static void main(String[] args){
        TidUserPwd userInfo = new TidUserPwd();

        String test = "EnbznwBDQMnKDsIBHHrPs+eiY8DfIesITgUVTpoNAeWDZsTvYjKyNa4AEqNE1w5kjDBMyzME3g7wxAzyOovR6/y3yVtQsiyWadEvc33rEVQobT+PXVGyx7i+2DWAQYMdw3iipGtQeys8mCYcUDucvlIXE9XfOXKvz/9r40qlrgYYZkE851wcsS6RDfJavIFZrQrx58T3APv+XWC3dLiTL/9kO29nFDWFT3fu8jvAxG5AdRJKHBtjnErwxIrr8xY1yRKMJFE2jKQM83GPGWgD4eHFGaypQoG8z3cvfSMBvtmAGKoGH+6DTqp5K6RzloRLq72NPyZpcqLRJnsU5Y/udg==";
        
        userInfo.setUserName("admin");
//        userInfo.setUserName("J0000461");
        userInfo.setPassword("123456");
        userInfo.setCode("8405");

        String ciphertext = JSONObject.toJSONString(userInfo);
        String endcodeCiphertext = RsaUtil.encryptByPublicKey(RsaUtil.getPublicKeyStr(),ciphertext);

        System.out.println(endcodeCiphertext);
        String decode = RsaUtil.decryptByPrivateKey(RsaUtil.getPrivateKeyStr(),test);
        System.out.println(JSONObject.parseObject(decode));
//
//
//
//
//        BCryptPasswordEncoder bcrypt = new BCryptPasswordEncoder();
//        System.out.println((bcrypt.matches("123456", "$2a$10$zoTxqkqI8pIAB8mLwvMdCuHmcISxIfzfF6kTE4lh5pK/VNJg3TPta")));
//        System.out.println((bcrypt.matches("12345678", "$2a$10$bBQwOFf/cOjJyRFQod2EKOS8flqDwDU/79ZgahMTYlyJ9ofWzNWQC")));

//        String url1 = "http://192.168.1.101:9007/api/v1/user?tid=a7e1ee6f40d6502fabf4878fa0ea2584";
////        String url2 = "http://192.168.1.107:9007/api/v1/user?tid=a7e1ee6f40d6502fabf4878fa0ea2584";
////        Random random = new Random();
////
////        int ran = 0;
////        for(int i = 1;i<= 10;i++){
////            try{
////                ran = random.nextInt(20) + 1;
////                if(ran >= 10){
////                    System.out.println("1========"+url1);
////                    HttpRequest httpRequest = new HttpRequest();
////                    httpRequest.testAddUser(url1);
////                }else {
////                    System.out.println("2========"+url2);
////                    HttpRequest httpRequest = new HttpRequest();
////                    httpRequest.testAddUser(url2);
////                }
////            }catch (Exception e){
////                e.getMessage();
////            }
////        }


        Integer sex = 2 ;
        System.out.println(sex == 0 ?"男" : sex==1?"女" : "保密");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date start = sdf.parse("2019-08-23");
            Calendar c = Calendar.getInstance();
            c.setTime(start);
//            c.add(Calendar.DATE,520);
            c.add(Calendar.DATE,1314);
            System.out.println(sdf.format(c.getTime()));
        }catch (Exception e){

        }



    }
}
